import {getToken,getAuthority} from '../../service/api'

const state = {
    money:0,
    authority:null
}

const actions = {
    saveMoney ({commit},data) {
        commit("SAVE_MONEY",data)
    },
    async SET_AUTHORITY ({commit},param) {


        const data = await getAuthority();
        // alert('获取成功');
        commit("setAuthority",data);


    }
}

const mutations = {

     /**
     * 存钱
     * @param num
     */
      SAVE_MONEY (state,n) {
          state.money+=n
      },

     /**
     * 获取全局权限配置信息
     * @param obj
     */
      setAuthority (state,param) {
          state.authority = param
      }  
        
}

export default {
    state,
    actions,
    mutations
}